import App from './App.vue'
import uView from '@/uni_modules/uview-ui'


import Vue from 'vue'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	...App
})
wx.cloud.init({
	env: "animal-4g5ks6ct0e7f251e"
})
/***
 * 时间格式化函数
 * @isTime {blur}  = [false] false:不返回时间
 */
Vue.prototype.$formatDateTime = function(date, isTime = false) {
	var d = new Date(date),
		month = '' + (d.getMonth() + 1),
		day = '' + d.getDate(),
		year = d.getFullYear(),
		hour = '' + d.getHours(),
		minute = '' + d.getMinutes(),
		second = '' + d.getSeconds();

	if (month.length < 2)
		month = '0' + month;
	if (day.length < 2)
		day = '0' + day;
	if (hour.length < 2)
		hour = '0' + hour;
	if (minute.length < 2)
		minute = '0' + minute;
	if (second.length < 2)
		second = '0' + second;

	if (isTime) { // 是否返回时间
		console.log([year, month, day].join('-') + ' ' + [hour, minute, second].join(':'))
		return [year, month, day].join('-') + ' ' + [hour, minute, second].join(':');
	} else {
		return [year, month, day].join('-')
	}
}

Vue.prototype.$db = wx.cloud.database()
Vue.prototype.$clould = wx.cloud

Vue.use(uView)
// 如此配置即可
uni.$u.config.unit = 'rpx'
app.$mount()